<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>大数据技术之HBase基本知识 | 袖清暮雨` Blog</title><meta name="author" content="袖清暮雨"><meta name="copyright" content="袖清暮雨"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="ffffff"><meta name="description" content="1.NoSQL基础1.1、NoSQL全称全称：not only SQL(非关系型数据库) 1.2、具体讲解A.不遵循传统RDBMS模型的数据库补充知识： 1RDBMS：关系型数据库管理系统。包含mysql，oracle，DB2... B.数据是非关系的，且不使用SQL作为主要的查询语言补充知识： 12&quot;关系&quot;指的是【主外键】。其中HBase具有一套自己的命令系统，因此不使用SQ">
<meta property="og:type" content="article">
<meta property="og:title" content="大数据技术之HBase基本知识">
<meta property="og:url" content="https://lemonworld.gitee.io/lemon-world/posts/6ea55398.html">
<meta property="og:site_name" content="袖清暮雨&#96; Blog">
<meta property="og:description" content="1.NoSQL基础1.1、NoSQL全称全称：not only SQL(非关系型数据库) 1.2、具体讲解A.不遵循传统RDBMS模型的数据库补充知识： 1RDBMS：关系型数据库管理系统。包含mysql，oracle，DB2... B.数据是非关系的，且不使用SQL作为主要的查询语言补充知识： 12&quot;关系&quot;指的是【主外键】。其中HBase具有一套自己的命令系统，因此不使用SQ">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/LemonWorld/picture/raw/master/img/%E9%AA%A8%E7%8E%8B.png">
<meta property="article:published_time" content="2024-03-03T16:00:00.000Z">
<meta property="article:modified_time" content="2024-03-22T09:13:32.729Z">
<meta property="article:author" content="袖清暮雨">
<meta property="article:tag" content="大数据">
<meta property="article:tag" content="实时数仓">
<meta property="article:tag" content="HBase">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/LemonWorld/picture/raw/master/img/%E9%AA%A8%E7%8E%8B.png"><link rel="shortcut icon" href="/lemon-world/./img/144.png"><link rel="canonical" href="https://lemonworld.gitee.io/lemon-world/posts/6ea55398.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//fonts.googleapis.com" crossorigin=""/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="manifest" href="/lemon-world/manifest.json"/><meta name="msapplication-TileColor" content="#3b70fc"/><link rel="apple-touch-icon" sizes="180x180" href="/lemon-world/img/siteicon/128.png"/><link rel="icon" type="image/png" sizes="32x32" href="/lemon-world/img/siteicon/32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/lemon-world/img/siteicon/16.png"/><link rel="mask-icon" href="/lemon-world/img/siteicon/128.png" color="#5bbad5"/><link rel="stylesheet" href="/lemon-world/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium+Web&amp;display=swap" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/lemon-world/',
  algolia: undefined,
  localSearch: {"path":"/lemon-world/search.xml","preload":false,"top_n_per_article":1,"unescape":false,"languages":{"hits_empty":"找不到您查询的内容：${query}","hits_stats":"共找到 ${hits} 篇文章"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlight.js","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":200},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: true,
    post: true
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  infinitegrid: {
    js: 'https://cdn.jsdelivr.net/npm/@egjs/infinitegrid/dist/infinitegrid.min.js',
    buttonText: '加载更多'
  },
  isPhotoFigcaption: true,
  islazyload: true,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: true,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '大数据技术之HBase基本知识',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2024-03-22 17:13:32'
}</script><script>(win=>{
      win.saveToLocal = {
        set: (key, value, ttl) => {
          if (ttl === 0) return
          const now = Date.now()
          const expiry = now + ttl * 86400000
          const item = {
            value,
            expiry
          }
          localStorage.setItem(key, JSON.stringify(item))
        },
      
        get: key => {
          const itemStr = localStorage.getItem(key)
      
          if (!itemStr) {
            return undefined
          }
          const item = JSON.parse(itemStr)
          const now = Date.now()
      
          if (now > item.expiry) {
            localStorage.removeItem(key)
            return undefined
          }
          return item.value
        }
      }
    
      win.getScript = (url, attr = {}) => new Promise((resolve, reject) => {
        const script = document.createElement('script')
        script.src = url
        script.async = true
        script.onerror = reject
        script.onload = script.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          script.onload = script.onreadystatechange = null
          resolve()
        }

        Object.keys(attr).forEach(key => {
          script.setAttribute(key, attr[key])
        })

        document.head.appendChild(script)
      })
    
      win.getCSS = (url, id = false) => new Promise((resolve, reject) => {
        const link = document.createElement('link')
        link.rel = 'stylesheet'
        link.href = url
        if (id) link.id = id
        link.onerror = reject
        link.onload = link.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          link.onload = link.onreadystatechange = null
          resolve()
        }
        document.head.appendChild(link)
      })
    
      win.activateDarkMode = () => {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = () => {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', 'ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
        if (t === 'dark') activateDarkMode()
        else if (t === 'light') activateLightMode()
      
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
      const detectApple = () => {
        if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
          document.documentElement.classList.add('apple')
        }
      }
      detectApple()
    })(window)</script><link rel="stylesheet" href="/css/font.css"><link rel="stylesheet" href="/css/custom.css" media="defer" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css"><!-- hexo injector head_end start --><link rel="stylesheet" href="https://cdn.cbd.int/hexo-butterfly-clock-anzhiyu@1.1.6/lib/clock.min.css" /><link rel="stylesheet" href="https://cdn.cbd.int/hexo-butterfly-wowjs/lib/animate.min.css" media="print" onload="this.media='screen'"><!-- hexo injector head_end end --><meta name="generator" content="Hexo 7.0.0"><link rel="alternate" href="/lemon-world/atom.xml" title="袖清暮雨` Blog" type="application/atom+xml">
</head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="/lemon-world/./img/sanjiu.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/lemon-world/archives/"><div class="headline">文章</div><div class="length-num">39</div></a><a href="/lemon-world/tags/"><div class="headline">标签</div><div class="length-num">21</div></a><a href="/lemon-world/categories/"><div class="headline">分类</div><div class="length-num">2</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/lemon-world/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fa-solid fa-list"></i><span> 学习路线</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/lemon-world/categories/%E5%AD%A6%E4%B9%A0%E4%B8%BB%E7%BA%BF/"><span> 学习主线</span></a></li><li><a class="site-page child" href="/lemon-world/categories/%E5%AD%A6%E4%B9%A0%E6%94%AF%E7%BA%BF/"><span> 学习支线</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/lemon-world/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/lemon-world/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/lemon-world/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/lemon-world/comments/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 更多</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/lemon-world/link/"><i class="fa-fw fas fa-link"></i><span> 相关链接</span></a></li><li><a class="site-page child" href="/lemon-world/picture/"><i class="fa-fw fa fa-camera-retro"></i><span> 相册</span></a></li></ul></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://gitee.com/LemonWorld/picture/raw/master/img/%E9%AA%A8%E7%8E%8B.png')"><nav id="nav"><span id="blog-info"><a href="/lemon-world/" title="袖清暮雨` Blog"><span class="site-name">袖清暮雨` Blog</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/lemon-world/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fa-solid fa-list"></i><span> 学习路线</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/lemon-world/categories/%E5%AD%A6%E4%B9%A0%E4%B8%BB%E7%BA%BF/"><span> 学习主线</span></a></li><li><a class="site-page child" href="/lemon-world/categories/%E5%AD%A6%E4%B9%A0%E6%94%AF%E7%BA%BF/"><span> 学习支线</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/lemon-world/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/lemon-world/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/lemon-world/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div><div class="menus_item"><a class="site-page" href="/lemon-world/comments/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 更多</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/lemon-world/link/"><i class="fa-fw fas fa-link"></i><span> 相关链接</span></a></li><li><a class="site-page child" href="/lemon-world/picture/"><i class="fa-fw fa fa-camera-retro"></i><span> 相册</span></a></li></ul></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">大数据技术之HBase基本知识</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2024-03-03T16:00:00.000Z" title="发表于 2024-03-04 00:00:00">2024-03-04</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2024-03-22T09:13:32.729Z" title="更新于 2024-03-22 17:13:32">2024-03-22</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/lemon-world/categories/%E5%AD%A6%E4%B9%A0%E4%B8%BB%E7%BA%BF/">学习主线</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="leancloud_visitors" id="/lemon-world/posts/6ea55398.html" data-flag-title="大数据技术之HBase基本知识"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span class="leancloud-visitors-count"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="1-NoSQL基础"><a href="#1-NoSQL基础" class="headerlink" title="1.NoSQL基础"></a>1.NoSQL基础</h1><h2 id="1-1、NoSQL全称"><a href="#1-1、NoSQL全称" class="headerlink" title="1.1、NoSQL全称"></a>1.1、NoSQL全称</h2><p><strong>全称</strong>：not only SQL(非关系型数据库)</p>
<h2 id="1-2、具体讲解"><a href="#1-2、具体讲解" class="headerlink" title="1.2、具体讲解"></a>1.2、具体讲解</h2><h3 id="A-不遵循传统RDBMS模型的数据库"><a href="#A-不遵循传统RDBMS模型的数据库" class="headerlink" title="A.不遵循传统RDBMS模型的数据库"></a>A.不遵循传统RDBMS模型的数据库</h3><p><strong>补充知识</strong>：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">RDBMS：关系型数据库管理系统。包含mysql，oracle，DB2...</span><br></pre></td></tr></table></figure>
<h3 id="B-数据是非关系的，且不使用SQL作为主要的查询语言"><a href="#B-数据是非关系的，且不使用SQL作为主要的查询语言" class="headerlink" title="B.数据是非关系的，且不使用SQL作为主要的查询语言"></a>B.数据是非关系的，且不使用SQL作为主要的查询语言</h3><p><strong>补充知识</strong>：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">&quot;关系&quot;指的是【主外键】。</span><br><span class="line">其中HBase具有一套自己的命令系统，因此不使用SQL为主要查询语句</span><br></pre></td></tr></table></figure>
<h3 id="C-解决数据库的-lt-伸缩性和可用性-gt-问题"><a href="#C-解决数据库的-lt-伸缩性和可用性-gt-问题" class="headerlink" title="C.解决数据库的&lt;伸缩性和可用性&gt;问题"></a>C.解决数据库的&lt;伸缩性和可用性&gt;问题</h3><h3 id="D-不针对一致性问题，但不可完全不一致"><a href="#D-不针对一致性问题，但不可完全不一致" class="headerlink" title="D.不针对一致性问题，但不可完全不一致"></a>D.不针对一致性问题，但不可完全不一致</h3><p><strong>补充知识</strong>：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">在大数据中，我们追求的是【最终一致性】。</span><br><span class="line">主要发生于实时数仓中。其数据计算通常采用——&lt;流处理和批处理&gt;</span><br></pre></td></tr></table></figure>
<h2 id="1-3、NoSQL与关系型数据库对比"><a href="#1-3、NoSQL与关系型数据库对比" class="headerlink" title="1.3、NoSQL与关系型数据库对比"></a>1.3、NoSQL与关系型数据库对比</h2><p><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/NOSQL%E4%B8%8E%E5%85%B3%E7%B3%BB%E5%9E%8B%E6%95%B0%E6%8D%AE%E5%BA%93%E5%AF%B9%E6%AF%94.png" alt="NoSQL与关系型数据库对比"></p>
<h1 id="2-HBase概述"><a href="#2-HBase概述" class="headerlink" title="2.HBase概述"></a>2.HBase概述</h1><p>HBase是一个<strong>列式存储</strong>的<strong>NoSQL数据库</strong>。同时，Hbase是一个<strong>分布式HashMap</strong>，其<strong>底层数据</strong>是<strong>Key-Value(键值对)</strong>的格式。默认情况下，<strong>HBase会将数据存储于HDFS中</strong>，利用其可靠性。</p>
<h1 id="3-HBase特点"><a href="#3-HBase特点" class="headerlink" title="3.HBase特点"></a>3.HBase特点</h1><h3 id="最主要的两大特点-优势"><a href="#最主要的两大特点-优势" class="headerlink" title="最主要的两大特点(优势)"></a>最主要的两大特点(优势)</h3><p><strong>1.</strong>列式存储</p>
<p><strong>2.</strong>吞吐量大</p>
<h3 id="其余特点-优势"><a href="#其余特点-优势" class="headerlink" title="其余特点(优势)"></a>其余特点(优势)</h3><p><strong>1.</strong>数据响应速度快</p>
<p><strong>2.</strong>支持随机读写</p>
<p><strong>3.</strong>可扩展性(可扩展20000+节点)</p>
<p><strong>4.</strong>高并发</p>
<h1 id="4-HBase架构"><a href="#4-HBase架构" class="headerlink" title="4.HBase架构"></a>4.HBase架构</h1><h2 id="4-1、物理架构"><a href="#4-1、物理架构" class="headerlink" title="4.1、物理架构"></a>4.1、物理架构</h2><p>HBase采用<strong>主从架构</strong>形式，主要组成：HMaster，HRegionServer，HRegion，ZooKeeper，DFS Client。</p>
<p><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/hbase%E6%9E%B6%E6%9E%84%E5%9B%BE.png" alt="HBase物理架构"></p>
<h3 id="4-1-1物理架构各部分讲解"><a href="#4-1-1物理架构各部分讲解" class="headerlink" title="4.1.1物理架构各部分讲解"></a>4.1.1物理架构各部分讲解</h3><p>&ensp; &ensp; &ensp;<strong>HMaster</strong>：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">1.是HBase集群的主节点，可以配置多个(用于备用HMaster backup)，实现HA</span><br><span class="line">2.【存储元数据】，同时处理元数据的变更</span><br><span class="line">3.负责RegionServer监视，负载均衡(分裂split)和故障迁移(容灾性)</span><br><span class="line">4.借助ZooKeeper，将元数据信息(meta)发送给客户端</span><br></pre></td></tr></table></figure>
<p>&ensp; &ensp; &ensp;<strong>HRegionServer</strong>：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">1.负责管理HBase的实际数据</span><br><span class="line">2.维护HLog</span><br><span class="line">3.刷新缓存至HDFS</span><br><span class="line">4.负责处理HRegion及其切片</span><br><span class="line">5.执行Compact操作【收缩操作】</span><br></pre></td></tr></table></figure>
<p>&ensp; &ensp; &ensp;<strong>HRegion</strong>：分区。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">补充点：</span><br><span class="line">	1.Region是HBase集群分布数据的最小单位</span><br><span class="line">	2.多个同样的Region不可存在于同一个RegionServer下</span><br></pre></td></tr></table></figure>
<p>&ensp; &ensp; &ensp;<strong>HLog</strong>：WAL日志</p>
<p>&ensp; &ensp; &ensp;<strong>Store</strong>：存储区</p>
<p>&ensp; &ensp; &ensp;<strong>MemStore</strong>：相当于缓存区</p>
<p>&ensp; &ensp; &ensp;<strong>StoreFile</strong>：对HDFS上文件(HFile)的<strong>包装</strong>,其存储了<strong>映射信息</strong>【HBase存储位置,DataNode位置…】</p>
<p>&ensp; &ensp; &ensp;<strong>HFile</strong>：存储于HDFS上的文件，相当于一个block</p>
<h3 id="4-1-2读取操作："><a href="#4-1-2读取操作：" class="headerlink" title="4.1.2读取操作："></a>4.1.2读取操作：</h3><p>ZooKeeper与HMaster和备用的HMaster backup之间都具有心跳。</p>
<p><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/hbase%E8%AF%BB%E5%8F%96.png" alt="hbase读取操作"></p>
<p><strong>具体过程讲解</strong>：</p>
<p>1.客户端通过zookeeper找到HMaster【定期】通过心跳发送过来的表的元数据信息【hbase:<strong>meta</strong>】。</p>
<p>2.客户端获取元素信息后，就会得知表在哪台或哪几台HRegionServer上，就可直接去读取HRegionServer上的数据。</p>
<h3 id="4-1-3写入操作：基于内存-MemStore-写"><a href="#4-1-3写入操作：基于内存-MemStore-写" class="headerlink" title="4.1.3写入操作：基于内存(MemStore)写"></a>4.1.3写入操作：基于内存(MemStore)写</h3><p>ZooKeeper与HMaster和备用的HMaster backup之间都具有心跳。</p>
<p><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/hbase%E5%86%99%E5%85%A52.0.png" alt="hbase写入操作"></p>
<p><strong>具体过程讲解</strong>：</p>
<p>客户端进行建表操作后，表会在一台机器上形成一个Region【Region为基本单位】。客户端会通过put操作先让数据进入HLog中去【容灾性：便于恢复】，然后再进入Region中的MemStore中去，就此写入的操作完成。【<strong>只需写到内存(MemStore)中就算完成操作了</strong>】</p>
<p><strong>后续过程补充</strong>：可以进行<strong>配置</strong>来控制MemStore的溢写条件【一定时间间隔溢出一次(3s左右)或者一定数量溢出一次】。MemStore溢写一次形成一个StoreFile，StoreFile包装了HFile。Hfile借助DFS Client写入HDFS中的DataNode中的block上面。</p>
<p><strong>注意：</strong>当一个Region写满后，会进行<strong>&lt;伸缩机制&gt;</strong>，在另一台机器上形成一个Region继续书写。</p>
<h3 id="4-1-4响应速度快的体现：都是基于内存操作"><a href="#4-1-4响应速度快的体现：都是基于内存操作" class="headerlink" title="4.1.4响应速度快的体现：都是基于内存操作"></a>4.1.4响应速度快的体现：都是基于内存操作</h3><h4 id="A：读取速度快-2个"><a href="#A：读取速度快-2个" class="headerlink" title="A：读取速度快(2个)"></a>A：读取速度快(2个)</h4><h5 id="BlockCache-块缓存-缓存机制——基于内存完成"><a href="#BlockCache-块缓存-缓存机制——基于内存完成" class="headerlink" title="BlockCache(块缓存)缓存机制——基于内存完成"></a><strong>BlockCache(块缓存)缓存机制——基于内存完成</strong></h5><p><strong>解释</strong>：经常被查询的数据会从磁盘中写入BlockCache缓存中来，当再次读取的时候，直接可以在BlockCache缓存中进行读取。</p>
<p>【注意】：初次读取数据时，依然要读磁盘。</p>
<p><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/hbase%E8%AF%BB%E8%BF%87%E7%A8%8B%E6%9E%B6%E6%9E%84%E5%9B%BE2.0.png" alt="hbase读过程架构图"></p>
<h5 id="Bloom-filter布隆过滤器——快速定位功能"><a href="#Bloom-filter布隆过滤器——快速定位功能" class="headerlink" title="Bloom filter布隆过滤器——快速定位功能"></a><strong>Bloom filter布隆过滤器——快速定位功能</strong></h5><p><strong>解释</strong>：Bloom filter相当于索引，判断所需的数据是否存在于此处的BlockCache中。</p>
<p>Bloom filter底层原理运用的是<strong>二进制向量</strong>，其<strong>效仿</strong>HahMap中的<strong>随机读写功能</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">补充知识：HashMap的随机读写功能讲解</span><br><span class="line">	=&gt;通过键的HashCode计算得出这个键值对在HahMap的主结构当中的下标。</span><br></pre></td></tr></table></figure>
<p><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/Bloomfilter%E5%8E%9F%E7%90%86%E5%9B%BE.png" alt="Bloom filter原理图"></p>
<p><strong>原理的详细讲解</strong>：</p>
<p>在此，我们自定义了三个哈希计算方式【三个Hash函数】=&gt;避免哈希碰撞的发生。单一的哈希算法不能保证不同的元素放入不同的位置。因此此处的三个Hash函数大大降低了哈希碰撞的发生。</p>
<p>二进制向量一开始全为0，当我们将url数据元素(字符串string)存入hbase中的时候，其中url1通过Hahs函数1计算得出三个值，在对这三个值分别进行二进制的算术运算分别将三个位置(1,5,9)标志为1。</p>
<p>当我们取值的时候，布隆过滤器就会通过三个哈希函数算出三个值，再通过位的方式判断这三个位置上面都为1.若都为1，则表示这个url1数据元素在里面。因此，布隆过滤器能快速确认有没有这条url1的数据。</p>
<p><strong>补充</strong>：<strong>Hash函数越多，组合越多，组合碰撞的概率就越低。</strong></p>
<h4 id="B：写入速度快"><a href="#B：写入速度快" class="headerlink" title="B：写入速度快"></a>B：写入速度快</h4><p>基于MemStore(缓存)进行写入操作。只需写到MemStore中即可完成写的操作。</p>
<h2 id="4-2、逻辑架构-数据层面"><a href="#4-2、逻辑架构-数据层面" class="headerlink" title="4.2、逻辑架构(数据层面)"></a>4.2、逻辑架构(数据层面)</h2><p><strong>HBase表的逻辑结构图</strong>：</p>
<p><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/hbase%E9%80%BB%E8%BE%91%E6%9E%B6%E6%9E%843.0.png" alt="HBase表的逻辑结构"></p>
<p><strong>名词解释</strong>：</p>
<ul>
<li><p>Column Family（列族）：HBase中的每个列都归属于某个列族，列族不能改变，一行可有多个列族，一个列族可有任意个列。</p>
</li>
<li><p>Column（列）：类似于关系型数据库中的列名。一般都是从属于某个列族，跟列族不一样，这些列都可以动态添加。</p>
</li>
<li>RowKey（行键）：行键是HBase记录条目的主键，物理存储时会按照RowKey的字典序排序存储，HBase基于RowKey实现索引。</li>
</ul>
<p><strong>补充点</strong>：<strong>行键映射列族，列族映射列</strong></p>
<h2 id="4-3、HBase元数据"><a href="#4-3、HBase元数据" class="headerlink" title="4.3、HBase元数据"></a>4.3、HBase元数据</h2><h3 id="4-3-1：元数据基本讲解"><a href="#4-3-1：元数据基本讲解" class="headerlink" title="4.3.1：元数据基本讲解"></a>4.3.1：元数据基本讲解</h3><p><strong>1</strong>.HBase中的HMaster负责管理元数据(<strong>meta</strong>)。</p>
<p><strong>2</strong>.系统目录表<strong>hbase:meta</strong>用于存放<strong>元数据</strong>。</p>
<p><strong>3</strong>.<strong>ZooKeeper</strong>存储<strong>hbase:meta</strong>表的<strong>位置信息</strong>。</p>
<h3 id="4-3-2：元数据的映射关系"><a href="#4-3-2：元数据的映射关系" class="headerlink" title="4.3.2：元数据的映射关系"></a>4.3.2：元数据的映射关系</h3><p>逻辑数据(<strong>表</strong>)存储于HBase中</p>
<p>物理数据(<strong>具体实际数据</strong>)存储于HDFS中</p>
<p><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E9%80%BB%E8%BE%91%E7%BB%93%E6%9E%84%E5%92%8C%E7%89%A9%E7%90%86%E7%BB%93%E6%9E%84%E4%B9%8B%E9%97%B4%E7%9A%84%E6%98%A0%E5%B0%84%E5%85%B3%E7%B3%BB.png" alt=""></p>
<p>由上图可知，当客户端拿到元数据的时候，就知道了<strong>逻辑数据存储在hbase上的哪个位置</strong>和<strong>物理数据存储在hdfs上的哪个位置</strong>。</p>
<h1 id="5-HBase主要优势讲解——列式存储与吞吐量大"><a href="#5-HBase主要优势讲解——列式存储与吞吐量大" class="headerlink" title="5.HBase主要优势讲解——列式存储与吞吐量大"></a>5.HBase主要优势讲解——列式存储与吞吐量大</h1><h2 id="优势一：列式存储"><a href="#优势一：列式存储" class="headerlink" title="优势一：列式存储"></a>优势一：列式存储</h2><h3 id="1-适合存储不规则的数据"><a href="#1-适合存储不规则的数据" class="headerlink" title="1.适合存储不规则的数据"></a>1.适合存储不规则的数据</h3><h4 id="与行式存储对比有何优势？"><a href="#与行式存储对比有何优势？" class="headerlink" title="与行式存储对比有何优势？"></a>与行式存储对比有何优势？</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">=&gt;【列式存储】可以和行式存储一样存储【规则的数据】之外，列式存储最大的优势在于适合存储【不规则的数据】。</span><br></pre></td></tr></table></figure>
<h4 id="HBase流行的原因分析"><a href="#HBase流行的原因分析" class="headerlink" title="HBase流行的原因分析"></a>HBase流行的原因分析</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">=&gt;现如今，不规则的数据急剧增加，差异化的数据同时激增，因此HBase由于列式存储的特点变得越来越流行。</span><br></pre></td></tr></table></figure>
<h3 id="2-节约空间"><a href="#2-节约空间" class="headerlink" title="2.节约空间"></a>2.节约空间</h3><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">列式存储可以节约因不规则数据所带来的空间上的浪费。</span><br><span class="line">=&gt;若是行式存储，会出现大量的NULL，造成空间上的浪费，而列式存储很好的解决了这一问题。</span><br></pre></td></tr></table></figure>
<h2 id="优势二：吞吐量大"><a href="#优势二：吞吐量大" class="headerlink" title="优势二：吞吐量大"></a>优势二：吞吐量大</h2><h3 id="1-吞量大"><a href="#1-吞量大" class="headerlink" title="1.吞量大"></a>1.吞量大</h3><h4 id="1-1：基于内存，写的速度快"><a href="#1-1：基于内存，写的速度快" class="headerlink" title="1.1：基于内存，写的速度快"></a>1.1：基于内存，写的速度快</h4><p>每一个列族对应一个存储区，每一个存储区（Store）对应一个memstore。在写操作时，只需负责将数据写入memstore内存中去即可完成写操作。无需等数据刷新至磁盘上。</p>
<h4 id="1-2：并行写"><a href="#1-2：并行写" class="headerlink" title="1.2：并行写"></a>1.2：并行写</h4><p>不同列族在不同的存储区（Store）中是并行进行写操作的。</p>
<h4 id="1-3：批量操作"><a href="#1-3：批量操作" class="headerlink" title="1.3：批量操作"></a>1.3：批量操作</h4><p>HBase是支持批量操作的。</p>
<p><strong>补充知识</strong>：批量的大小一般与【机器性能】有关。</p>
<h4 id="1-4：WAL机制——保证数据安全"><a href="#1-4：WAL机制——保证数据安全" class="headerlink" title="1.4：WAL机制——保证数据安全"></a>1.4：WAL机制——保证数据安全</h4><p>面对保证内存在写数据时可能会导致数据丢失问题中，我们通过WAL机制，借助于HLog来实现预存储功能。当内存丢失时，可以快速恢复。</p>
<p><strong>补充知识</strong></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">WAL机制=&gt;理论体系</span><br><span class="line">HLog=&gt;具体记录理论体系的数据载体</span><br></pre></td></tr></table></figure>
<h3 id="2-吐量大"><a href="#2-吐量大" class="headerlink" title="2.吐量大"></a>2.吐量大</h3><h4 id="2-1：MemStore"><a href="#2-1：MemStore" class="headerlink" title="2.1：MemStore"></a>2.1：MemStore</h4><p>数据在内存中，读取时速度快。</p>
<h4 id="2-2：BlockCache-块缓存-——基于内存完成"><a href="#2-2：BlockCache-块缓存-——基于内存完成" class="headerlink" title="2.2：BlockCache(块缓存)——基于内存完成"></a>2.2：BlockCache(块缓存)——基于内存完成</h4><p>首次读取时，性能并不是很快。【依然要从StoreFile中的数据读取到BlockCache中去】</p>
<p>之后再次读取同样的数据时，性能很快。【直接从BlockCache中进行读取】</p>
<h4 id="2-3：Bloom-Filter——快速定位"><a href="#2-3：Bloom-Filter——快速定位" class="headerlink" title="2.3：Bloom Filter——快速定位"></a>2.3：Bloom Filter——快速定位</h4><p>客户端读取内存时，借助于Bloom Filter来检索并定位。</p>
<p><strong>讲解</strong>：键通过多个哈希函数来快速的判断所要读取的数据是否在此BlockCache中或者MemStore中。因此检索的速度快，能够实现快速定位功能。</p>
<h4 id="总体概念图"><a href="#总体概念图" class="headerlink" title="总体概念图"></a>总体概念图</h4><p><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/hbase%E8%AF%BB%E8%BF%87%E7%A8%8B%E6%9E%B6%E6%9E%84%E5%9B%BE%E7%AE%80%E5%8C%96%E7%89%882.0.png" alt="hbase读过程架构图简化版"></p>
<h1 id="6-HBase分布式的理解"><a href="#6-HBase分布式的理解" class="headerlink" title="6.HBase分布式的理解"></a>6.HBase分布式的理解</h1><p><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/hbase%E5%88%86%E5%B8%83%E5%BC%8F2.0.png" alt=""></p>
<p><strong>讲解</strong>：</p>
<p><strong>1、</strong>HDFS原本是以行存储的。但<strong>在HBase中</strong>，HDFS是以<strong>列</strong>存储。</p>
<p><strong>2、</strong>一个Table会被分配到大小大致相同的Region中去。在<strong>Region</strong>中存储逻辑数据，在<strong>HDFS</strong>中存储物理数据。</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="https://lemonworld.gitee.io/lemon-world">袖清暮雨</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="https://lemonworld.gitee.io/lemon-world/posts/6ea55398.html">https://lemonworld.gitee.io/lemon-world/posts/6ea55398.html</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://lemonworld.gitee.io/lemon-world" target="_blank">袖清暮雨` Blog</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/lemon-world/tags/%E5%A4%A7%E6%95%B0%E6%8D%AE/">大数据</a><a class="post-meta__tags" href="/lemon-world/tags/%E5%AE%9E%E6%97%B6%E6%95%B0%E4%BB%93/">实时数仓</a><a class="post-meta__tags" href="/lemon-world/tags/HBase/">HBase</a></div><div class="post_share"><div class="social-share" data-image="https://gitee.com/LemonWorld/picture/raw/master/img/%E9%AA%A8%E7%8E%8B.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/lemon-world/posts/db281d8f.html" title="大数据技术之HBase操作归纳"><img class="cover" src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E9%BE%99%E4%B8%8E%E8%99%8E.png" onerror="onerror=null;src='/lemon-world/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">大数据技术之HBase操作归纳</div></div></a></div><div class="next-post pull-right"><a href="/lemon-world/posts/a7c7967c.html" title="Java集合——HashMap讲解"><img class="cover" src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E8%8A%99%E5%AE%81%E5%A8%9C.png" onerror="onerror=null;src='/lemon-world/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Java集合——HashMap讲解</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/lemon-world/posts/87f2a73.html" title="HBase的伸缩性和可用性"><img class="cover" src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E7%94%BB%E5%B8%83.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2024-03-06</div><div class="title">HBase的伸缩性和可用性</div></div></a></div><div><a href="/lemon-world/posts/db281d8f.html" title="大数据技术之HBase操作归纳"><img class="cover" src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E9%BE%99%E4%B8%8E%E8%99%8E.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2024-03-04</div><div class="title">大数据技术之HBase操作归纳</div></div></a></div><div><a href="/lemon-world/posts/4c9d8329.html" title="流处理(stream)与批处理(batch)讲解"><img class="cover" src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E9%BB%91%E8%89%B2%E5%9B%9B%E5%8F%B6%E8%8D%89.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2024-03-06</div><div class="title">流处理(stream)与批处理(batch)讲解</div></div></a></div><div><a href="/lemon-world/posts/54849ec2.html" title="大数据之Hadoop（HDFS Java客户端操作）"><img class="cover" src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E7%8E%9B%E5%A5%87%E7%8E%9B.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2024-01-14</div><div class="title">大数据之Hadoop（HDFS Java客户端操作）</div></div></a></div><div><a href="/lemon-world/posts/aa5ee629.html" title="大数据之Hadoop（HDFS写文件）"><img class="cover" src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E5%B0%8F%E5%9F%8B.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2024-01-11</div><div class="title">大数据之Hadoop（HDFS写文件）</div></div></a></div><div><a href="/lemon-world/posts/874e14c1.html" title="大数据之Hadoop（HDFS查看用户行为日志文件）"><img class="cover" src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E5%AD%A4%E7%8B%AC%E6%91%87%E6%BB%9A.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2024-01-15</div><div class="title">大数据之Hadoop（HDFS查看用户行为日志文件）</div></div></a></div></div></div><hr class="custom-hr"/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src= "" data-lazy-src="/lemon-world/./img/sanjiu.jpg" onerror="this.onerror=null;this.src='/lemon-world/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">袖清暮雨</div><div class="author-info__description">一个技术宅的博客</div></div><div class="card-info-data site-data is-center"><a href="/lemon-world/archives/"><div class="headline">文章</div><div class="length-num">39</div></a><a href="/lemon-world/tags/"><div class="headline">标签</div><div class="length-num">21</div></a><a href="/lemon-world/categories/"><div class="headline">分类</div><div class="length-num">2</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/Lemon-World"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/Lemon-World" target="_blank" title="Github"><i class="fab fa-github" style="color: #24292e;"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">欢迎来到袖清暮雨`Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#1-NoSQL%E5%9F%BA%E7%A1%80"><span class="toc-number">1.</span> <span class="toc-text">1.NoSQL基础</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-1%E3%80%81NoSQL%E5%85%A8%E7%A7%B0"><span class="toc-number">1.1.</span> <span class="toc-text">1.1、NoSQL全称</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#1-2%E3%80%81%E5%85%B7%E4%BD%93%E8%AE%B2%E8%A7%A3"><span class="toc-number">1.2.</span> <span class="toc-text">1.2、具体讲解</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#A-%E4%B8%8D%E9%81%B5%E5%BE%AA%E4%BC%A0%E7%BB%9FRDBMS%E6%A8%A1%E5%9E%8B%E7%9A%84%E6%95%B0%E6%8D%AE%E5%BA%93"><span class="toc-number">1.2.1.</span> <span class="toc-text">A.不遵循传统RDBMS模型的数据库</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#B-%E6%95%B0%E6%8D%AE%E6%98%AF%E9%9D%9E%E5%85%B3%E7%B3%BB%E7%9A%84%EF%BC%8C%E4%B8%94%E4%B8%8D%E4%BD%BF%E7%94%A8SQL%E4%BD%9C%E4%B8%BA%E4%B8%BB%E8%A6%81%E7%9A%84%E6%9F%A5%E8%AF%A2%E8%AF%AD%E8%A8%80"><span class="toc-number">1.2.2.</span> <span class="toc-text">B.数据是非关系的，且不使用SQL作为主要的查询语言</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#C-%E8%A7%A3%E5%86%B3%E6%95%B0%E6%8D%AE%E5%BA%93%E7%9A%84-lt-%E4%BC%B8%E7%BC%A9%E6%80%A7%E5%92%8C%E5%8F%AF%E7%94%A8%E6%80%A7-gt-%E9%97%AE%E9%A2%98"><span class="toc-number">1.2.3.</span> <span class="toc-text">C.解决数据库的&lt;伸缩性和可用性&gt;问题</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#D-%E4%B8%8D%E9%92%88%E5%AF%B9%E4%B8%80%E8%87%B4%E6%80%A7%E9%97%AE%E9%A2%98%EF%BC%8C%E4%BD%86%E4%B8%8D%E5%8F%AF%E5%AE%8C%E5%85%A8%E4%B8%8D%E4%B8%80%E8%87%B4"><span class="toc-number">1.2.4.</span> <span class="toc-text">D.不针对一致性问题，但不可完全不一致</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#1-3%E3%80%81NoSQL%E4%B8%8E%E5%85%B3%E7%B3%BB%E5%9E%8B%E6%95%B0%E6%8D%AE%E5%BA%93%E5%AF%B9%E6%AF%94"><span class="toc-number">1.3.</span> <span class="toc-text">1.3、NoSQL与关系型数据库对比</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#2-HBase%E6%A6%82%E8%BF%B0"><span class="toc-number">2.</span> <span class="toc-text">2.HBase概述</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#3-HBase%E7%89%B9%E7%82%B9"><span class="toc-number">3.</span> <span class="toc-text">3.HBase特点</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9C%80%E4%B8%BB%E8%A6%81%E7%9A%84%E4%B8%A4%E5%A4%A7%E7%89%B9%E7%82%B9-%E4%BC%98%E5%8A%BF"><span class="toc-number">3.0.1.</span> <span class="toc-text">最主要的两大特点(优势)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%85%B6%E4%BD%99%E7%89%B9%E7%82%B9-%E4%BC%98%E5%8A%BF"><span class="toc-number">3.0.2.</span> <span class="toc-text">其余特点(优势)</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#4-HBase%E6%9E%B6%E6%9E%84"><span class="toc-number">4.</span> <span class="toc-text">4.HBase架构</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#4-1%E3%80%81%E7%89%A9%E7%90%86%E6%9E%B6%E6%9E%84"><span class="toc-number">4.1.</span> <span class="toc-text">4.1、物理架构</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#4-1-1%E7%89%A9%E7%90%86%E6%9E%B6%E6%9E%84%E5%90%84%E9%83%A8%E5%88%86%E8%AE%B2%E8%A7%A3"><span class="toc-number">4.1.1.</span> <span class="toc-text">4.1.1物理架构各部分讲解</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-1-2%E8%AF%BB%E5%8F%96%E6%93%8D%E4%BD%9C%EF%BC%9A"><span class="toc-number">4.1.2.</span> <span class="toc-text">4.1.2读取操作：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-1-3%E5%86%99%E5%85%A5%E6%93%8D%E4%BD%9C%EF%BC%9A%E5%9F%BA%E4%BA%8E%E5%86%85%E5%AD%98-MemStore-%E5%86%99"><span class="toc-number">4.1.3.</span> <span class="toc-text">4.1.3写入操作：基于内存(MemStore)写</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-1-4%E5%93%8D%E5%BA%94%E9%80%9F%E5%BA%A6%E5%BF%AB%E7%9A%84%E4%BD%93%E7%8E%B0%EF%BC%9A%E9%83%BD%E6%98%AF%E5%9F%BA%E4%BA%8E%E5%86%85%E5%AD%98%E6%93%8D%E4%BD%9C"><span class="toc-number">4.1.4.</span> <span class="toc-text">4.1.4响应速度快的体现：都是基于内存操作</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#A%EF%BC%9A%E8%AF%BB%E5%8F%96%E9%80%9F%E5%BA%A6%E5%BF%AB-2%E4%B8%AA"><span class="toc-number">4.1.4.1.</span> <span class="toc-text">A：读取速度快(2个)</span></a><ol class="toc-child"><li class="toc-item toc-level-5"><a class="toc-link" href="#BlockCache-%E5%9D%97%E7%BC%93%E5%AD%98-%E7%BC%93%E5%AD%98%E6%9C%BA%E5%88%B6%E2%80%94%E2%80%94%E5%9F%BA%E4%BA%8E%E5%86%85%E5%AD%98%E5%AE%8C%E6%88%90"><span class="toc-number">4.1.4.1.1.</span> <span class="toc-text">BlockCache(块缓存)缓存机制——基于内存完成</span></a></li><li class="toc-item toc-level-5"><a class="toc-link" href="#Bloom-filter%E5%B8%83%E9%9A%86%E8%BF%87%E6%BB%A4%E5%99%A8%E2%80%94%E2%80%94%E5%BF%AB%E9%80%9F%E5%AE%9A%E4%BD%8D%E5%8A%9F%E8%83%BD"><span class="toc-number">4.1.4.1.2.</span> <span class="toc-text">Bloom filter布隆过滤器——快速定位功能</span></a></li></ol></li><li class="toc-item toc-level-4"><a class="toc-link" href="#B%EF%BC%9A%E5%86%99%E5%85%A5%E9%80%9F%E5%BA%A6%E5%BF%AB"><span class="toc-number">4.1.4.2.</span> <span class="toc-text">B：写入速度快</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-2%E3%80%81%E9%80%BB%E8%BE%91%E6%9E%B6%E6%9E%84-%E6%95%B0%E6%8D%AE%E5%B1%82%E9%9D%A2"><span class="toc-number">4.2.</span> <span class="toc-text">4.2、逻辑架构(数据层面)</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-3%E3%80%81HBase%E5%85%83%E6%95%B0%E6%8D%AE"><span class="toc-number">4.3.</span> <span class="toc-text">4.3、HBase元数据</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#4-3-1%EF%BC%9A%E5%85%83%E6%95%B0%E6%8D%AE%E5%9F%BA%E6%9C%AC%E8%AE%B2%E8%A7%A3"><span class="toc-number">4.3.1.</span> <span class="toc-text">4.3.1：元数据基本讲解</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-3-2%EF%BC%9A%E5%85%83%E6%95%B0%E6%8D%AE%E7%9A%84%E6%98%A0%E5%B0%84%E5%85%B3%E7%B3%BB"><span class="toc-number">4.3.2.</span> <span class="toc-text">4.3.2：元数据的映射关系</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#5-HBase%E4%B8%BB%E8%A6%81%E4%BC%98%E5%8A%BF%E8%AE%B2%E8%A7%A3%E2%80%94%E2%80%94%E5%88%97%E5%BC%8F%E5%AD%98%E5%82%A8%E4%B8%8E%E5%90%9E%E5%90%90%E9%87%8F%E5%A4%A7"><span class="toc-number">5.</span> <span class="toc-text">5.HBase主要优势讲解——列式存储与吞吐量大</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BC%98%E5%8A%BF%E4%B8%80%EF%BC%9A%E5%88%97%E5%BC%8F%E5%AD%98%E5%82%A8"><span class="toc-number">5.1.</span> <span class="toc-text">优势一：列式存储</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-%E9%80%82%E5%90%88%E5%AD%98%E5%82%A8%E4%B8%8D%E8%A7%84%E5%88%99%E7%9A%84%E6%95%B0%E6%8D%AE"><span class="toc-number">5.1.1.</span> <span class="toc-text">1.适合存储不规则的数据</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%B8%8E%E8%A1%8C%E5%BC%8F%E5%AD%98%E5%82%A8%E5%AF%B9%E6%AF%94%E6%9C%89%E4%BD%95%E4%BC%98%E5%8A%BF%EF%BC%9F"><span class="toc-number">5.1.1.1.</span> <span class="toc-text">与行式存储对比有何优势？</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#HBase%E6%B5%81%E8%A1%8C%E7%9A%84%E5%8E%9F%E5%9B%A0%E5%88%86%E6%9E%90"><span class="toc-number">5.1.1.2.</span> <span class="toc-text">HBase流行的原因分析</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-%E8%8A%82%E7%BA%A6%E7%A9%BA%E9%97%B4"><span class="toc-number">5.1.2.</span> <span class="toc-text">2.节约空间</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BC%98%E5%8A%BF%E4%BA%8C%EF%BC%9A%E5%90%9E%E5%90%90%E9%87%8F%E5%A4%A7"><span class="toc-number">5.2.</span> <span class="toc-text">优势二：吞吐量大</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-%E5%90%9E%E9%87%8F%E5%A4%A7"><span class="toc-number">5.2.1.</span> <span class="toc-text">1.吞量大</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1-1%EF%BC%9A%E5%9F%BA%E4%BA%8E%E5%86%85%E5%AD%98%EF%BC%8C%E5%86%99%E7%9A%84%E9%80%9F%E5%BA%A6%E5%BF%AB"><span class="toc-number">5.2.1.1.</span> <span class="toc-text">1.1：基于内存，写的速度快</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-2%EF%BC%9A%E5%B9%B6%E8%A1%8C%E5%86%99"><span class="toc-number">5.2.1.2.</span> <span class="toc-text">1.2：并行写</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-3%EF%BC%9A%E6%89%B9%E9%87%8F%E6%93%8D%E4%BD%9C"><span class="toc-number">5.2.1.3.</span> <span class="toc-text">1.3：批量操作</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#1-4%EF%BC%9AWAL%E6%9C%BA%E5%88%B6%E2%80%94%E2%80%94%E4%BF%9D%E8%AF%81%E6%95%B0%E6%8D%AE%E5%AE%89%E5%85%A8"><span class="toc-number">5.2.1.4.</span> <span class="toc-text">1.4：WAL机制——保证数据安全</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-%E5%90%90%E9%87%8F%E5%A4%A7"><span class="toc-number">5.2.2.</span> <span class="toc-text">2.吐量大</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#2-1%EF%BC%9AMemStore"><span class="toc-number">5.2.2.1.</span> <span class="toc-text">2.1：MemStore</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-2%EF%BC%9ABlockCache-%E5%9D%97%E7%BC%93%E5%AD%98-%E2%80%94%E2%80%94%E5%9F%BA%E4%BA%8E%E5%86%85%E5%AD%98%E5%AE%8C%E6%88%90"><span class="toc-number">5.2.2.2.</span> <span class="toc-text">2.2：BlockCache(块缓存)——基于内存完成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-3%EF%BC%9ABloom-Filter%E2%80%94%E2%80%94%E5%BF%AB%E9%80%9F%E5%AE%9A%E4%BD%8D"><span class="toc-number">5.2.2.3.</span> <span class="toc-text">2.3：Bloom Filter——快速定位</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%80%BB%E4%BD%93%E6%A6%82%E5%BF%B5%E5%9B%BE"><span class="toc-number">5.2.2.4.</span> <span class="toc-text">总体概念图</span></a></li></ol></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#6-HBase%E5%88%86%E5%B8%83%E5%BC%8F%E7%9A%84%E7%90%86%E8%A7%A3"><span class="toc-number">6.</span> <span class="toc-text">6.HBase分布式的理解</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/lemon-world/posts/dc99e4b2.html" title="项目搭建之文件上传下载"><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E9%97%B4%E8%B0%8D%E8%BF%87%E5%AE%B6%E5%AE%B6.png" onerror="this.onerror=null;this.src='/lemon-world/img/404.jpg'" alt="项目搭建之文件上传下载"/></a><div class="content"><a class="title" href="/lemon-world/posts/dc99e4b2.html" title="项目搭建之文件上传下载">项目搭建之文件上传下载</a><time datetime="2024-04-19T16:00:00.000Z" title="发表于 2024-04-20 00:00:00">2024-04-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/lemon-world/posts/cca50181.html" title="项目搭建之Vue工程之路由"><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E5%A4%95%E9%98%B3%E4%B8%8B%E7%9A%84%E7%BA%A2%E8%B7%AF%E7%81%AF.png" onerror="this.onerror=null;this.src='/lemon-world/img/404.jpg'" alt="项目搭建之Vue工程之路由"/></a><div class="content"><a class="title" href="/lemon-world/posts/cca50181.html" title="项目搭建之Vue工程之路由">项目搭建之Vue工程之路由</a><time datetime="2024-04-11T16:00:00.000Z" title="发表于 2024-04-12 00:00:00">2024-04-12</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/lemon-world/posts/1e302926.html" title="项目搭建之前后端交互（跨域,页面跳转,Pinia）+实战"><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E8%BF%BD%E6%9C%88.png" onerror="this.onerror=null;this.src='/lemon-world/img/404.jpg'" alt="项目搭建之前后端交互（跨域,页面跳转,Pinia）+实战"/></a><div class="content"><a class="title" href="/lemon-world/posts/1e302926.html" title="项目搭建之前后端交互（跨域,页面跳转,Pinia）+实战">项目搭建之前后端交互（跨域,页面跳转,Pinia）+实战</a><time datetime="2024-04-10T16:00:00.000Z" title="发表于 2024-04-11 00:00:00">2024-04-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/lemon-world/posts/7f721cb1.html" title="项目搭建之SpringBoot基本操作归纳"><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E6%A1%A5%E4%B8%8B%E5%A4%95%E9%98%B3.png" onerror="this.onerror=null;this.src='/lemon-world/img/404.jpg'" alt="项目搭建之SpringBoot基本操作归纳"/></a><div class="content"><a class="title" href="/lemon-world/posts/7f721cb1.html" title="项目搭建之SpringBoot基本操作归纳">项目搭建之SpringBoot基本操作归纳</a><time datetime="2024-03-26T16:00:00.000Z" title="发表于 2024-03-27 00:00:00">2024-03-27</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/lemon-world/posts/452204e8.html" title="项目搭建之SpringBoot配置归纳"><img src= "" data-lazy-src="https://gitee.com/LemonWorld/picture/raw/master/img/%E9%AD%94%E6%B3%95%E5%B0%91%E5%A5%B3%E5%B0%8F%E5%9C%86.png" onerror="this.onerror=null;this.src='/lemon-world/img/404.jpg'" alt="项目搭建之SpringBoot配置归纳"/></a><div class="content"><a class="title" href="/lemon-world/posts/452204e8.html" title="项目搭建之SpringBoot配置归纳">项目搭建之SpringBoot配置归纳</a><time datetime="2024-03-17T16:00:00.000Z" title="发表于 2024-03-18 00:00:00">2024-03-18</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('https://gitee.com/LemonWorld/picture/raw/master/img/%E9%AA%A8%E7%8E%8B.png')"><div id="footer-wrap"><div class="copyright">&copy;2023 - 2024 By 袖清暮雨</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">welcome to <a href="https://lemonworld.gitee.io/lemon-world/">袖清暮雨</a> Blog!</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/lemon-world/js/utils.js"></script><script src="/lemon-world/js/main.js"></script><script src="/lemon-world/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><div class="js-pjax"><script>(() => {
  const initValine = () => {
    const valine = new Valine(Object.assign({
      el: '#vcomment',
      appId: 'lmEQpOsJf8mT3BIGHZZ7EDq4-gzGzoHsz',
      appKey: '7APMLg7dJeJb0sE6hHymEyaY',
      avatar: 'monsterid',
      serverURLs: '7frkCVvvwQAZBPCcjmeKotvz',
      emojiMaps: "",
      path: window.location.pathname,
      visitor: true
    }, null))
  }

  const loadValine = async () => {
    if (typeof Valine === 'function') initValine()
    else {
      await getScript('https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js')
      initValine()
    }
  }

  if ('Valine' === 'Valine' || !false) {
    if (false) btf.loadComment(document.getElementById('vcomment'),loadValine)
    else setTimeout(loadValine, 0)
  } else {
    window.loadOtherComment = loadValine
  }
})()</script></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/metingjs/dist/Meting.min.js"></script><div class="app-refresh" id="app-refresh" style="position: fixed;top: -2.2rem;left: 0;right: 0;z-index: 99999;padding: 0 1rem;font-size: 15px;height: 2.2rem;transition: all 0.3s ease;"><div class="app-refresh-wrap" style=" display: flex;color: #fff;height: 100%;align-items: center;justify-content: center;"><label>✨ 有新文章啦！✨  👉</label><a href="javascript:void(0)" onclick="location.reload()"><span style="color: #fff;text-decoration: underline;cursor: pointer;">点击使用</span></a></div></div><script>if ('serviceWorker' in navigator) {
if (navigator.serviceWorker.controller) {
navigator.serviceWorker.addEventListener('controllerchange', function() {
showNotification()
})
}
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js')
})
}
function showNotification() {
if (GLOBAL_CONFIG.Snackbar) {
var snackbarBg =
document.documentElement.getAttribute('data-theme') === 'light' ?
GLOBAL_CONFIG.Snackbar.bgLight :
GLOBAL_CONFIG.Snackbar.bgDark
var snackbarPos = GLOBAL_CONFIG.Snackbar.position
Snackbar.show({
text: '✨ 有新文章啦！✨  👉',
backgroundColor: snackbarBg,
duration: 500000,
pos: snackbarPos,
actionText: '点击使用',
actionTextColor: '#fff',
onActionClick: function(e) {
location.reload()
},
})
} else {
var showBg =
document.documentElement.getAttribute('data-theme') === 'light' ?
'#3b70fc' :
'#1f1f1f'
var cssText = `top: 0; background: ${showBg};`
document.getElementById('app-refresh').style.cssText = cssText
}
}</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/lemon-world/js/search/local-search.js"></script></div></div><!-- hexo injector body_end start --><script data-pjax>
  function butterfly_clock_anzhiyu_injector_config(){
    var parent_div_git = document.getElementsByClassName('sticky_layout')[0];
    var item_html = '<div class="card-widget card-clock"><div class="card-glass"><div class="card-background"><div class="card-content"><div id="hexo_electric_clock"><img class="entered loading" id="card-clock-loading" src= "" data-lazy-src="https://cdn.cbd.int/hexo-butterfly-clock-anzhiyu@1.1.6/lib/loading.gif" style="height: 120px; width: 100%;" data-ll-status="loading"/></div></div></div></div></div>';
    console.log('已挂载butterfly_clock_anzhiyu')
    if(parent_div_git) {
      parent_div_git.insertAdjacentHTML("afterbegin",item_html)
    }
  }
  var elist = 'null'.split(',');
  var cpage = location.pathname;
  var epage = 'all';
  var qweather_key = '8fb12d98d85c4c88831aa57a850d7b9f';
  var gaud_map_key = '70fbf493bf0d0ba744a308b047ea559e';
  var baidu_ak_key = 'undefined';
  var flag = 0;
  var clock_rectangle = '112.6534116,27.96920845';
  var clock_default_rectangle_enable = 'true';

  for (var i=0;i<elist.length;i++){
    if (cpage.includes(elist[i])){
      flag++;
    }
  }

  if ((epage ==='all')&&(flag == 0)){
    butterfly_clock_anzhiyu_injector_config();
  }
  else if (epage === cpage){
    butterfly_clock_anzhiyu_injector_config();
  }
  </script><script src="https://widget.qweather.net/simple/static/js/he-simple-common.js?v=2.0"></script><script data-pjax src="https://cdn.cbd.int/hexo-butterfly-clock-anzhiyu@1.1.6/lib/clock.min.js"></script><div class="js-pjax"><script async="async">var arr = document.getElementsByClassName('recent-post-item');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '1.5s');
    arr[i].setAttribute('data-wow-delay', '200ms');
    arr[i].setAttribute('data-wow-offset', '30');
    arr[i].setAttribute('data-wow-iteration', '1');
  }</script><script async="async">var arr = document.getElementsByClassName('card-widget');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '');
    arr[i].setAttribute('data-wow-delay', '200ms');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script><script async="async">var arr = document.getElementsByClassName('flink-list-card');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__flipInY');
    arr[i].setAttribute('data-wow-duration', '3s');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script><script async="async">var arr = document.getElementsByClassName('flink-list-card');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__animated');
    arr[i].setAttribute('data-wow-duration', '3s');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script><script async="async">var arr = document.getElementsByClassName('article-sort-item');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__slideInRight');
    arr[i].setAttribute('data-wow-duration', '1.5s');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script><script async="async">var arr = document.getElementsByClassName('site-card');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__flipInY');
    arr[i].setAttribute('data-wow-duration', '3s');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script><script async="async">var arr = document.getElementsByClassName('site-card');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__animated');
    arr[i].setAttribute('data-wow-duration', '3s');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script></div><script defer src="https://cdn.cbd.int/hexo-butterfly-wowjs/lib/wow.min.js"></script><script defer src="https://cdn.cbd.int/hexo-butterfly-wowjs/lib/wow_init.js"></script><!-- hexo injector body_end end --><script src="/lemon-world/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"tagMode":false,"debug":false,"model":{"jsonPath":"/lemon-world/live2dw/assets/koharu.model.json"},"display":{"position":"left","width":150,"height":300},"mobile":{"show":false},"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/"});</script></body></html>